export function setColorCofig(value) { //设置程序的主题颜色
	try {
		uni.setStorageSync('colorCofig', value)
	} catch (e) {

	}
}
export function getColorCofig() { //获取设置程序的主题颜色
	var color = uni.getStorageSync('colorCofig')
	return color
}
export function setRole(role) { //设置角色
	try {
		uni.setStorageSync('role', role);
		console.log('设置role成功', role)
	} catch (e) {
		// error
	}
}
export function getRole() { //获取角色
	var role = uni.getStorageSync('role')
	console.log(role)
	return role
}
export function removeRole() { //删除角色
	uni.removeStorageSync('role')
}
export function setToken(token) { //设置token
	try {
		uni.setStorageSync('token', token)
		console.log('token', token)
	} catch (e) {

	}
}
export function getToken() { //获取token
	var token = uni.getStorageSync('token')
	
	// var token = "1629984276SWaJ9VgZ1o6G4Bzg"
	
	console.log(token)
	return token
}
export function removeToken() { //清除token
	uni.removeStorageSync('token')
}
export function setRecommend(recommend) { //推荐码
	try {
		uni.setStorageSync('recommend', recommend)
		console.log('recommend', recommend)
	} catch (e) {

	}
}
export function getRecommend() { //获取推荐码
	var recommend = uni.getStorageSync('recommend')
	console.log(recommend)
	return recommend
}
export function setopenId(openid) { //设置openid
	try {
		uni.setStorageSync('openid', openid)
		console.log('openid', openid)
	} catch (e) {

	}
}
export function getopenId() { //获取openid
	var openid = uni.getStorageSync('openid')
	console.log(openid)
	return openid
}
export function setUserInfo(userdata) { //保存用户信息
	try {
		uni.setStorageSync('userinfo', userdata)
		console.log('userinfo', userdata)
	} catch (e) {

	}
}
export function getUserInfo() { //获取用户信息
	var openid = uni.getStorageSync('userinfo')
	console.log(openid)
	return openid
}
export function setPlatform(value) { //获取当前的运行环境是小程序还是公众号
	try {
		uni.setStorageSync('platform', value)
		console.log('platform', value)
	} catch (e) {

	}
}
export function setCateId(value) { //设置分类ID
	try {
		uni.setStorageSync('CateId', value)
		console.log('CateId', value)
	} catch (e) {

	}
}
export function getCateId() { //获取用户信息
	var CateId = uni.getStorageSync('CateId')
	console.log(CateId)
	return CateId
}
export function removeCateId() { //获取用户信息
	uni.removeStorageSync('CateId')
}
export function setMaster(value){//存储服务点称
	try {
		uni.setStorageSync('master', value)
		console.log('master', value)
	} catch (e) {
	
	}
}
export function getMaster() { //获取服务点息
	var master = uni.getStorageSync('master')
	console.log(master)
	return master
}
export function setlocation(value){//存储提货点名称
	try {
		uni.setStorageSync('location', value)
		console.log('location', value)
	} catch (e) {
	
	}
}
export function getlocation() { //获取提货点信息
	var location = uni.getStorageSync('location')
	console.log(location)
	return location
}
export function setGoodData(value){//存储订单
	try {
		uni.setStorageSync('GoodData', value)
		console.log('GoodData', value)
	} catch (e) {
	
	}
}
export function getGoodData(){
	var GoodData = uni.getStorageSync('GoodData')
	console.log(GoodData)
	return GoodData
}
export function setIntegral(value){//存储订单
	try {
		uni.setStorageSync('integral', value)
		console.log('integral', value)
	} catch (e) {
	
	}
}
export function setGoodId(value){
	try {
		uni.setStorageSync('goodid', value)
		console.log('goodid', value)
	} catch (e) {
	
	}
}
export function getGoodId(){
	var goodid = uni.getStorageSync('goodid')
	console.log(goodid)
	return goodid
}
export function removeGoodId() { //获取用户信息
	uni.removeStorageSync('goodid')
}
export function getIntegral(){
	var integral = uni.getStorageSync('integral')
	console.log(integral)
	return integral
}
export function setTime(fmt,date){//格式化时间
	  let ret;
	    const opt = {
	        "Y+": date.getFullYear().toString(),        // 年
	        "m+": (date.getMonth() + 1).toString(),     // 月
	        "d+": date.getDate().toString(),            // 日
	        "H+": date.getHours().toString(),           // 时
	        "M+": date.getMinutes().toString(),         // 分
	        "S+": date.getSeconds().toString()          // 秒
	        // 有其他格式化字符需求可以继续添加，必须转化成字符串
	    };
	    for (let k in opt) {
	        ret = new RegExp("(" + k + ")").exec(fmt);
	        if (ret) {
	            fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
	        };
	    };
	    return fmt;
}
export function setTel(tel){
		tel = "" + tel;
		// d表示数字0-9,{3}表示需要3个，所以d{3}就是表示3个数字
		var reg=/(\d{3})\d{4}(\d{4})/;
		//$1是第一个小括号里的 ,$2是第2个小括号里的 
		var tel1 = tel.replace(reg, "$1****$2")
		return tel1
}